package com.changgou.service.goods.controller;

import com.changgou.common.pojo.Result;
import com.changgou.common.pojo.StatusCode;
import com.changgou.goods.pojo.Spec;
import com.changgou.service.goods.service.SpecService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Package: com.changgou.service.goods.controller
 * ClassName: SpecController
 * Description:
 *
 * @Author : 福森森
 * @Create : 2024/8/26 21:42
 */
@RequestMapping("/spec")
@RestController
public class SpecController {
    @Autowired
    private SpecService specService;

    /**
     * 根据商品分类名称查询规格列表
     * @param category
     * @return
     */
    @GetMapping("/category/{category}")
    public Result<Spec> findListByCategoryName(@PathVariable String category){
        List<Map> specList = specService.findSpecListByCategoryName(category);
        return new Result<>(true, StatusCode.OK,"",specList);
    }

}
